﻿using System;
using System.Collections;
using ProjectDanmaku.Core;
using ProjectDanmaku.Enemy;
using ProjectDanmaku.Util;
using UnityEngine;
using UnityEngine.SceneManagement;

namespace ProjectDanmaku.Level.Level0
{
    public class Level0Script : MonoBehaviour
    {
        [SerializeField] private GameObject bossPrefab;
        
        private EnemyBehavior _boss0Behavior;

        private void Start()
        {
            var boss = Instantiate(bossPrefab, transform);
            boss.transform.position = CoordUtility.GetPosFromCoord(new Vector2(8, 10));

            _boss0Behavior = boss.GetComponentInChildren<EnemyBehavior>();
            Debug.Log(_boss0Behavior);

            StartCoroutine(MainCoroutine());
        }

        private IEnumerator MainCoroutine()
        {
            yield return StartCoroutine(_boss0Behavior.MainCoroutine());
            
            SceneManager.LoadScene("Scenes/GameResults");
        }
    }
}